/*
 * @Description: 
 * @Autor: kaikaima
 * @Date: 2021-05-01 16:52:50
 * @LastEditors: kaikaima
 * @LastEditTime: 2021-05-01 16:55:19
 */

#include "M.h"

int main(int argc, char* argv[]){
    unsigned N; std::cin>>N;
    double** A=new double* [N+1];
    for(int i=0;i<=N;i++){
        A[i]=new double[N];
    }

    for(int i=0;i<=N;i++)
    for(int j=0;j<N;j++)
        std::cin>>A[i][j];

    Matrix test(N);
    test.set(A);

    A[N]=test.Least_squares(A[N]);
    for(int i=0;i<N;i++)
    std::cout<<A[N][i]<<" ";
    std::cout<<std::endl;
    for(int i=0;i<=N;i++) delete[] A[i];
    delete[] A;
    return 0;
}